<%@ page import="com.system.dao.DoctorDao"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="ui" uri="http://com.am.tag" %>
<%@ include file="../common.jsp" %>
<%
	String record_id = request.getParameter("record_id");
	DoctorDao dao = new DoctorDao();
	Map<String,Object> map = dao.getDressingInfo(record_id);
	pageContext.setAttribute("map", map);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'dressing.jsp' starting page</title>
    <style type="text/css">
    	#receipt {
    		text-align:left;
			width:250px;
			height:100%;
			top:150px;
			left:350px;
		}
		#title {
			font-family: "微软雅黑", Verdana, Arial, Helvetica, sans-serif;
    		font-size:22px;
    		color:#242424;
    		font-weight:bold;
		}
    </style>
     <!-- 插入打印控件 -->
      <OBJECT  ID="jatoolsPrinter" CLASSID="CLSID:B43D3361-D075-4BE2-87FE-057188254255"
                  codebase="jatoolsPrinter.cab#version=8,6,0,0"></OBJECT>  
    
    <script type="text/javascript">
    
    	function doPrint(how) { 
   			 var myDoc = {
   			 	settings:{paperName:'a5'},   // 选择a4纸张进行打印
   			 	//settings:{orientation:2},   // 选择横向打印,1为纵向，2为横向
   			 	/*settings:{topMargin:100,
		                  leftMargin:100,
		                  bottomMargin:100,
		                  rightMargin:100},   // 设置上下左距页边距为10毫米，注意，单位是 1/10毫米
		        settings:{printer:'OKi5530'},//设置到打印机 'OKi5530'
		        */
        		documents: document,
        		copyrights: '杰创软件拥有版权  www.jatools.com'
   			 }; 
	   		 if (how == '打印预览...') {
	        	 jatoolsPrinter.printPreview(myDoc);} // 打印预览
	    	 else if (how == '打印...') {
	         	jatoolsPrinter.print(myDoc, false); // 打印前弹出打印设置对话框
	         }
	    	else
	         	jatoolsPrinter.print(myDoc, false); // 不弹出对话框打印
		}
    	
    	function doCheck()
    	{
    		if($.trim($("#place").val())=="")
    		{
    			alert("换药部位不能为空");
    			return false;
    		}
    		
    		if($.trim($("#scope").val())=="")
    		{
    			alert("换药范围不能为空");
    			return false;
    		}
    	
    		if($("input[name='method']:checked").length == 0)
    		{
    			alert("请选择换药方法");
    			return false;
    		}
    		
    		if($.trim($("#times").val())=="")
    		{
    			alert("换药次数不能为空");
    			return false;
    		}
    		
    		if(!check_integer($.trim($("#days").val())))
    		{
    			alert("换药天数必须为数字");
    			return false;
    		}
    		
    		if(!check_integer($.trim($("#time").val())))
    		{
    			alert("换药次数必须为数字");
    			return false;
    		}
    		
    		
    		if(!check_integer($.trim($("#times").val())))
    		{
    			alert("换药总次数必须为数字");
    			return false;
    		}
    		
    		return true;
    	}
    	
    	function doSave()
    	{
    		if(doCheck())
    		{
    			doPrint('打印...');
    			var map = Form.formToBean("winForm");
		 		map.record_id = "${param.record_id}";
		 		
		 		ajax.remoteCall("com.system.dao.DoctorDao:dressing",[map],function(reply){
		 			var result = reply.getResult();
		 			alert(result.value);
		 			if(result.type == "success")
		 			{
		 				var dlg = Dialog.getInstance("view");
						var parent = dlg.getParam("window");
						parent.directSubmit = "false";
						dlg.close();
		 			}
		 		});
    		}
			/* $("#surePrint").click(); */
	 	}
    </script>
  </head>
  
  <body>
  <form id="winForm" name="winForm">
	<input id="dressingId" name="dressingId" type="hidden" value="${map['id']}">
	<%-- <div style="margin-left:460px;margin-top:10px;">
		<ui:Permission value="doctor_dressing_print">
			<input type="button" id="surePrint"  style="background:url(${path }/images/common/hp_printer.png); width:64px;height:64;border:0" onclick="doPrint('打印...')">
		</ui:Permission>
	</div> --%>
	<div id="page1" style="font-size:10">
	<table id="receipt" cellSpacing="0" cellPadding="0" style="width:100%;" border="0" align="center">
		<tr  height="40px">
    		<td id="title" colspan="6" align="center" valign="bottom">广东技术师范学院门诊部</td>
		</tr>
		<tr  height="40px">
    		<td id="title" colspan="6" align="center" valign="middle">换药单</td>
		</tr>
		<tr  height="20px">
			<td align="left" colspan="6">
			<div>
				<span style="margin-left:18px">医保卡号：${map['card_num']}</span>
				<span style="margin-left:8px">换药编号：${map['number']}</span>
				<span style="margin-left:10px">日期：${map['create_time']}</span></div></td>
			<%-- <td align="right" colspan="2">医保卡号：${map['card_num']}</td>
			<td align="center" colspan="2">换药编号：${map['number']}</td>
			<td align="left" colspan="2">日期：${map['create_time']}</td> --%>
		</tr>
		
		<tr  height="0px">
			<td colspan="6">
				<hr color="#838B8B" align="center" size="2" style="width:95%;" />
			</td>
		</tr>
		
		<tr  height="20px">
			<td align="left" colspan="6">
			<div>
				<span style="margin-left:42px">姓名：${map['name']}</span>
				<span style="margin-left:50px">性别：${map['sex']}</span>
				<span style="margin-left:50px">年龄：${map['age']}</span></div></td>
			<%-- <td align="center" colspan="2">性别：${map['sex']}</td>
			<td align="left" colspan="2">年龄：${map['age']}</td> --%>
		</tr>
		<tr  height="20px">
			<td colspan="6">
				<div style="display:inline;margin-left:20px">人员费别:学生<input type="checkbox"  value="0" name="type" <c:if test="${map['type'] == 0}">checked</c:if> />10%
					教工<input type="checkbox"  value="1" name="type" <c:if test="${map['type'] == 1}">checked</c:if> />10%
					退休<input type="checkbox"  value="2" name="type" <c:if test="${map['type'] == 2}">checked</c:if> />5%
					离休<input type="checkbox"  value="3" name="type" <c:if test="${map['type'] == 3}">checked</c:if> />0%
					全费<input type="checkbox"  value="4" name="type" <c:if test="${map['type'] == 4}">checked</c:if> />100%
				</div>
			</td>
			<%-- <td align="right" width="20%">人员费别：&nbsp;&nbsp;</td>
			<td align="left" width="15.5%">学生<input type="checkbox"  value="0" name="type" <c:if test="${map['type'] == 0}">checked</c:if> />10%</td>
			<td align="left" width="15.5%">教工<input type="checkbox"  value="1" name="type" <c:if test="${map['type'] == 1}">checked</c:if> />10%</td>
			<td align="left" width="15.5%">退休<input type="checkbox"  value="2" name="type" <c:if test="${map['type'] == 2}">checked</c:if> />5%</td>
			<td align="left" width="15.5%">离休<input type="checkbox"  value="3" name="type" <c:if test="${map['type'] == 3}">checked</c:if> />0%</td>
			<td align="left" width="18%">全费<input type="checkbox"  value="4" name="type" <c:if test="${map['type'] == 4}">checked</c:if> />100%</td> --%>
		</tr>
	
		<tr  height="0px">
			<td colspan="6">
				<hr color="#838B8B" align="center" size="2" style="width:95%;" />
			</td>
		</tr>
		
		<tr  height="35px">
    		<td colspan="6" align="left" valign="middle">
    			<font style="font-weight:bold;font-size:small;margin-left:1.4cm;">换药部位:</font>
    			<input type="text" name="place" id="place" style="border:0;;width:63%;BORDER-RIGHT: medium none;BORDER-TOP: medium none;BORDER-LEFT: medium none;BORDER-BOTTOM:black 1px solid;" value="${map['place']}">
    		</td>
		</tr>
		<tr  height="35px">
    		<td colspan="6" align="left" valign="middle">
    			<font style="font-weight:bold;font-size:small;margin-left:0.6cm;">换药范围大小:</font>
    			<input type="text" name="scope" id="scope" style="border:0;;width:63%;BORDER-RIGHT: medium none;BORDER-TOP: medium none;BORDER-LEFT: medium none;BORDER-BOTTOM:black 1px solid;" value="${map['scope']}">
    		</td>
		</tr>
		<tr  height="35px">
    		<td colspan="6" align="left" valign="middle">
    			<font style="font-weight:bold;font-size:small;margin-left:1.1cm;">换药方法：</font>
    		</td>
		</tr>
		
		<tr  height="25px">
			<td align="left" colspan="6">
				<input type="checkbox" name="method" id="" value="1" style="margin-left:1.3cm;" <c:if test="${fn:contains(map['method'],'1')}">checked</c:if> />&nbsp;1.&nbsp;&nbsp;75%酒精纱布条
			</td>
		</tr>
		<tr  height="25px">
			<td align="left" colspan="6">
				<input type="checkbox" name="method" id="" value="2" style="margin-left:1.3cm;" <c:if test="${fn:contains(map['method'],'2')}">checked</c:if> />&nbsp;2.&nbsp;&nbsp;碘伏纱条
			</td>
		</tr>
		<tr  height="25px">
			<td align="left" colspan="6">
				<input type="checkbox" name="method" id="" value="3" style="margin-left:1.3cm;" <c:if test="${fn:contains(map['method'],'3')}">checked</c:if> />&nbsp;3.&nbsp;&nbsp;0.1-0.2%利凡诺尔纱条
			</td>
		</tr>
		<tr  height="25px">
			<td align="left" colspan="6">
				<input type="checkbox" name="method" id="" value="4" style="margin-left:1.3cm;" <c:if test="${fn:contains(map['method'],'4')}">checked</c:if>/>&nbsp;4.&nbsp;&nbsp;鱼石脂外敷
			</td>
		</tr>
		<tr  height="25px">
			<td align="left" colspan="6">
				<input type="checkbox" name="method" id="" value="5" style="margin-left:1.3cm;" <c:if test="${fn:contains(map['method'],'5')}">checked</c:if>/>&nbsp;5.&nbsp;&nbsp;消炎镇痛膏外敷
			</td>
		</tr>
		<tr  height="25px">
			<td align="left" colspan="6">
				<input type="checkbox" name="method" id="" value="6" style="margin-left:1.3cm;" <c:if test="${fn:contains(map['method'],'6')}">checked</c:if>/>&nbsp;6.&nbsp;&nbsp;50%硫酸镁纱条外敷
			</td>
		</tr>
		<tr  height="25px">
			<td align="left" colspan="6">
				<input type="checkbox" name="method" id="" value="7" style="margin-left:1.3cm;" <c:if test="${fn:contains(map['method'],'7')}">checked</c:if>/>&nbsp;7.&nbsp;&nbsp;利福平+灭菌凡士林纱布块外敷
			</td>
		</tr>
		<tr  height="25px">
			<td align="left" colspan="6">
				<input type="checkbox" name="method" id="" value="8" style="margin-left:1.3cm;" <c:if test="${fn:contains(map['method'],'8')}">checked</c:if>/>&nbsp;8.&nbsp;&nbsp;灭菌凡士林纱条填塞引流
			</td>
		</tr>
		<tr  height="25px">
			<td align="left" colspan="6">
				<input type="checkbox" name="method" id="" value="9" style="margin-left:1.3cm;" <c:if test="${fn:contains(map['method'],'9')}">checked</c:if>/>&nbsp;9.&nbsp;&nbsp;拆线
			</td>
		</tr>
		<tr  height="25px">
			<td align="left" colspan="6">
				<input type="checkbox" name="method" id="" value="10" style="margin-left:1.3cm;" <c:if test="${fn:contains(map['method'],'10')}">checked</c:if>/>&nbsp;10.&nbsp;&nbsp;特殊要求
			</td>
		</tr>
		
		<tr>
    		<td colspan="6" align="left" valign="middle">
    			<font style="font-weight:bold;font-size:small;margin-left:1.1cm;">换药次数：</font>
    			<input type="text" id="days" name="days" value="${map['days']}" style="border:0;;width:20px;BORDER-RIGHT: medium none;BORDER-TOP: medium none;BORDER-LEFT: medium none;BORDER-BOTTOM:black 1px solid;text-align:center">天
    			<input type="text" id="time" name="time" value="${map['time']}" style="border:0;;width:20px;BORDER-RIGHT: medium none;BORDER-TOP: medium none;BORDER-LEFT: medium none;BORDER-BOTTOM:black 1px solid;text-align:center">次
    			&nbsp;&nbsp;&nbsp;共<input type="text" id="times" name="times" value="${map['times']}" style="border:0;;width:25px;BORDER-RIGHT: medium none;BORDER-TOP: medium none;BORDER-LEFT: medium none;BORDER-BOTTOM:black 1px solid;text-align:center">次
    		</td>
		</tr>
		<%-- <tr  height="25px">
			<td align="left" colspan="6">
				<font style="margin-left:1.5cm;">每天</font><input type="text" id="times" name="times" value="${map['times']}" style="border:0;;width:30px;BORDER-RIGHT: medium none;BORDER-TOP: medium none;BORDER-LEFT: medium none;BORDER-BOTTOM:black 1px solid;text-align:center">次
			</td>
		</tr> --%>
		
		<tr  height="0px">
			<td colspan="6">
				<hr color="#838B8B" align="center" size="2" style="width:95%;" />
			</td>
		</tr>
		
		<tr> 
			<td colspan="6">
				<div>
					<span style="margin-left:30px">就诊医生：${map['user_name']}</span>
					<span style="margin-left:20px">换药护士：<input type="text" name="nurse" id="nurse" style="border:0;width:50"></span>
					<span style="margin-left:15px">实收金额：<input type="text" name="spend" id="spend" style="border:0;width:50"></span>
				</div>
				</td>
			<!-- <td align="center" valign="middle" colspan="2">换药护士：
				<input type="text" name="nurse" id="nurse" style="border:0;;width:80">
			</td>
			<td align="left" valign="middle" colspan="2">实收金额：
				<input type="text" name="spend" id="spend" style="border:0;;width:80">
			</td> -->
		</tr>
	</table>
	</div>
	</form>
  </body>
</html>
